<template>
  <div v-if="!CommonDefine.useful(channel.selectedModel.store)">
    <a-range-picker
      v-model:value="state.drange"
      style="width: 320px"
      valueFormat="YYYY-MM-DD"
      :locale="locale"
      :placeholder="[$t('127'), $t('141')]"
    />
    <br />
    <a-select
      v-model:value="state.committers"
      mode="multiple"
      style="width: 320px; margin-top: 8px"
      :placeholder="$t('128')"
    >
      <a-select-option :value="uid">{{ $t("236") }}</a-select-option>
      <a-select-option
        v-for="item in appStore.otherUsers"
        :key="item.id"
        :value="item.id"
      >
        {{ item.name }}
      </a-select-option>
    </a-select>
  </div>
  <a-divider />
  <FveEditor
    ref="refFvee"
    :fields="appStore.allModelFieldMap.get(channel.selectedModel.id)"
  ></FveEditor>
</template>
<script setup>
import { reactive, computed, ref } from "vue";
import "dayjs/locale/zh-cn";
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
import CommonDefine from "@/component/CommonDefine";
import FveEditor from "@/component/query/FveEditor.vue";

const appStore = CommonDefine.appStore();
const channel = CommonDefine.channel();
const refFvee = ref();
const uid = computed(() => Number(localStorage.getItem("uid")));
const state = reactive({
  drange: [],
  committers: [],
  fvfs: [],
});

const getFilters = () => {
  state.fvfs = refFvee.value.getFves();
  return state;
};

defineExpose({ getFilters });
</script>
